

import type { Istoreorder } from './entity';
import type { IPageParams } from '@/types/table'
import request from '@/api/request'

export function getPageList(params: IPageParams) {
  return request({
    url: '/admin/store/order/list',
    method: 'get',
    params,
    loading: true
  })
}

export function storeorderDel(data) {
  return request({
    url: `admin/storeorder/delete`,
    method: 'post',
    data
  })
}
export function storeorderinfo(id) {
  return request({
    url: `admin/storeorder/info/${id}`,
    method: 'get'
  })
}
export function storeorderSelect(id) {
  return request({
    url: `admin/storeorder/select`,
    method: 'get'
  })
}

export function storeorderAddup(data) {
  return request({
    url: `admin/storeorder/${!data.id ? 'save' : 'update'}`,
    method: 'post',
    data
  })
}

/**
 * 订单 列表 获取各状态数量
 * @param params
 */
export function orderStatusNumApi(params: any) {
  return request({
    url: '/admin/store/order/status/num',
    method: 'get',
    params
  })
}
/**
 *面单默认配置信息
 */
export function sheetInfoApi() {
  return request({
    url: `/admin/store/order/sheet/info`,
    method: 'get'
  })
}
/**
 * @description 一号通 -- 电子面单模板
 */
export function exportTempApi(params: any) {
  return request({
    url: '/admin/express/template',
    method: 'get',
    params
  })
}
/**
 * @description 全部物流公司
 */
export function expressAllApi(params: any) {
  return request({
    url: 'admin/express/all',
    method: 'get',
    params
  })
}
/**
 * 订单 发货
 * @param prams
 */
export function orderSendApi(data: any) {
  return request({
    url: '/admin/store/order/send',
    method: 'post',
    data
  })
}
/**
 * 订单 详情
 * @param prams
 */
export function orderDetailApi(orderNo: string) {
  return request({
    url: '/admin/store/order/info',
    method: 'get',
    params: { orderNo }
  })
}

/**
 * 订单 核销订单
 * @param prams
 */
export function writeUpdateApi(vCode: string) {
  return request({
    url: `/admin/store/order/writeUpdate/${vCode}`,
    method: 'get'
  })
}
/**
 * 订单 记录
 * @param prams
 */
export function orderLogApi(params: any) {
  return request({
    url: '/admin/store/order/status/list',
    method: 'get',
    params
  })
}
/**
 * 订单 备注
 * @param prams
 */
export function orderMarkApi(params: any) {
  return request({
    url: '/admin/store/order/mark',
    method: 'post',
    params
  })
}

/**
 * 订单 拒绝退款
 * @param prams
 */
export function orderRefuseApi(params: any) {
  return request({
    url: '/admin/store/order/refund/refuse',
    method: 'get',
    params
  })
}
/**
 * 订单 立即退款
 * @param prams
 */
export function orderRefundApi(params: any) {
  return request({
    url: '/admin/store/order/refund',
    method: 'get',
    params
  })
}
/**
 * 订单 删除
 * @param params
 */
export function orderDeleteApi(params: any) {
  return request({
    url: '/admin/store/order/delete',
    method: 'get',
    params
  })
}